-
Notifications
You must be signed in to change notification settings - Fork 488
GPU Framework: automatically generate GPUDefParametersDefaults.h #14972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
REQUEST FOR PRODUCTION RELEASES: This will add The following labels are available |
71b8e58 to
16e7fec
Compare
7ae23b1 to
174fcd4
Compare
davidrohr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, but perhaps you could implement some improvements.
dependencies/FindO2GPU.cmake
Outdated
| elseif(backend STREQUAL "HIP") # HIP filter | ||
| set(TARGET_ARCH "${HIP_TARGET}" PARENT_SCOPE) | ||
| return() | ||
| else() # Return both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you return both?
I would probably have a generic default target, which can be queried by "backend = default" explicitly, we could also set a default for opencl explicitly, and in case the backend does not match any known one, I would fail with message(FATAL_ERROR ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I return both s.t. the default parameters header has always both a CUDA or HIP fallback in case both backends are required to be compiled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, now I think I understood how it works :).
Then I would call it "ALL", and export explicitly the defaults for all backends, including OpenCL.
And still fail in an else case for unknown backends.
dependencies/FindO2GPU.cmake
Outdated
| function(set_target_cuda_arch target) | ||
| if(CUDA_COMPUTETARGET AND (CUDA_COMPUTETARGET MATCHES "86" OR CUDA_COMPUTETARGET MATCHES "89")) | ||
| function(detect_gpu_arch backend) # Detect GPU architecture, optionally filterring by backend | ||
| set(TARGET_ARCH "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since your if / else below covers all cases, I think there is no reason to initialize them to empty?
| else() | ||
| set(TARGET_ARCH ${GPU_ARCH}) | ||
| endif() | ||
| add_custom_command( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand, why you need to execute CMake explicitly on that cmake file [gpu_param_header_generator.cmake](https://github.com/AliceO2Group/AliceO2/pull/14972/changes#diff-69d48e46e923fe79aeab700a7a1ea6b0dc5b8d927a8493d8f449b168b52d50ba).
Couldn't you just include that cmake file, that would also execute it, or do I miss something?
Or better, I would put everything in that CMake file in a function, include that CMake file, and then just call the function.
| file(APPEND "${TMP_HEADER}" "\n// Default parameters if not defined for the target architecture\n\n") | ||
| #Default parameters | ||
| foreach(TYPE IN LISTS TYPES) | ||
| # Get all keys of this TYPE as a semicolon-separated list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the copy&paste from the code above. Could you extract the duplicated part in a function?
…nerate GPU parameters using json file and CMake
174fcd4 to
a97a95b
Compare
a97a95b to
b3b1c57
Compare
Remove GPUDefParametersDefaults.h and generate GPU parameters using json file and CMake. Results checked with deterministic mode.